﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BLL.SysManage
{
    public class T_PUB_USERROLE
    {
        private readonly DALL.SysManage.T_PUB_USERROLE dal = new DALL.SysManage.T_PUB_USERROLE();
        public T_PUB_USERROLE()
        { }

        public List<Model.SysManage.T_PUB_USERROLE> GetUserRoleList(string strUserID)
        {
            string strWhere = string.Format(" USER_ID={0}", strUserID);
            return GetModelList(strWhere);
        }
        public void addSysRoleAll(IList<Model.SysManage.T_PUB_USERROLE> ilModel)
        {
            dal.AddList(ilModel);
        }
        /// <summary>
        /// 用户角色
        /// </summary>
        /// <param name="strUserID"></param>
        /// <param name="strRoleID"></param>
        /// <returns></returns>
        public List<Model.SysManage.T_PUB_USERROLE> GetModleByRoleAndUser(string strUserID, string strRoleID)
        {
            string strWhere = string.Format(" USER_ID={0} and ROLE_ID={1}", strUserID, strRoleID);
            return GetModelList(strWhere);
        }
        #region  Method


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.SysManage.T_PUB_USERROLE model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.SysManage.T_PUB_USERROLE model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int ID)
        {
            return dal.Delete(ID);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.SysManage.T_PUB_USERROLE GetModel(int ID)
        {

            return dal.GetModel(ID);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.SysManage.T_PUB_USERROLE> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return dal.GetListArray(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }
        #endregion  Method
    }
}
